package com.itaq.cheetah.serviceA.config.web.dto;

import cn.hutool.crypto.SecureUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author cheetah
 * @date 2022/07/25
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SsoSignSource {

    private String data;

    private String platformId;

    private String platformSecret;

    private String flowId;

    private String businessId;

    private Long timestamp;

    private String sign;

    /**
     * 签名源值=data+platformId+flowId+businessId+platformSecret+timestamp
     * 签名值=对签名源值 MD5 签名，对签名做Base64编码
     *
     * @return 签名结果的16进制字符串
     */
    public String sign() {
        String sb =
                data +
                        platformId +
                        flowId +
                        businessId +
                        platformSecret +
                        timestamp;
        return SecureUtil.md5(sb);
    }


}
